<template>
  <el-alert type="success" class="mt-1"
    >isSupported：{{ isSupported }}</el-alert
  >

  <el-alert type="success" class="mt-1"
    >isConnected：{{ isConnected }}</el-alert
  >
  <el-alert class="mt-1" type="error"
    >device:{{ device?.name }}{{ device?.id }}</el-alert
  >

  <el-alert class="mt-1" type="error"
    >server:{{ server?.device?.name }}{{ server?.device?.id }}</el-alert
  >

  <el-button @click="requestDevice" type="primary" size="small" class="mt-1"
    >获取连接</el-button
  >
  <el-alert class="mt-1" type="error">error:{{ error }}</el-alert>
  <div>杨艺</div>
</template>
<script setup lang="ts">
import { watch } from 'vue';
import { useBluetooth } from '@vueuse/core';
const { isConnected, isSupported, device, requestDevice, error, server } =
  useBluetooth({
    acceptAllDevices: true,
  });

watch(device, (value) => {
  console.log(value);
  console.log(server.value);
});
</script>
